home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 5259 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  3.5 KB

  1. Path: vb.franken.de!volker
  2. From: volker@vb.franken.de (Volker Barthelmann)
  3. Subject: Re: 680X0 -> PPC translator?
  4. Newsgroups: comp.sys.amiga.programmer
  5. References: <313D3A8F.148C@sapiens.com> <volker.0fpv@vb.franken.de> <3143E4EB.7303@sapiens.com>
  6. X-Newsreader: TIN [AMIGA 1.3 950726BETA PL0]
  7. Message-ID: <volker.0fsu@vb.franken.de>
  8. Date: 11 Mar 96 23:02:07 MET
  9. Organization: home
  10.  
  11.  
  12. In article <3143E4EB.7303@sapiens.com> you wrote:
  13. :
  14. : Well, even so it still doesn't affect the translation process and that's simply becuase in
  15. : order to make a dynamic call (ie run-time address calc.) the base address of the function is
  16. : referenced somewhere in the program right?!
  17.  
  18. It doesn't have to be.
  19.  
  20. : so you can collect all these addresses and then see
  21. : where they're used as jump/call operands in an indirect call somewhere else in the program.
  22.  
  23. Easy said, but really doing this is a different story. First, You'll have to
  24. kind of disassemble the program and therefore You have to know what is data
  25. and what is code, but that's what You want to decide, so...
  26.  
  27. Also doing this kind of analysis is pretty much impossible on Assembler code.
  28.  
  29. : remember that all such addresses are 'lea'ed somewhere in the program and probably stored in
  30. : some variable in memory and when needed is used to load an address register for making the jump
  31.  
  32. And a variable in memory in assembler looks like xyz(a7), but only at one
  33. point, because at another point it is xyz+c(a7). It is probably impossible
  34. to detect if they point to the same address.
  35.  
  36. : or simply used directly, in either case to resolve the problem of dynamic address resolution,
  37. : address context analysis must be performed on EACH such address in the program, while it
  38. : implies hugh data structures, it is very much theoratically possible. also bear in mind that
  39.  
  40. It is not theoretically possible. There are some simple cases where it may
  41. work, that's all.
  42.  
  43. : all external references are assumed to be translated code already, so we don't care about that
  44. : but ALL internal references can be resolved because SOMEWHERE, SOMEONE must have used them and
  45. : don't tell me that function addresses are being used in arithmatic calculations, that is simply
  46. : weird programming, don't you agree and so the exact entry point is located somewhere in the
  47.  
  48. I don't agree.
  49. Function addresses are often used in arithmetic calculations. Examples are
  50. copying of code or control-structures like in special switch-statements.
  51.  
  52. : program, hey no one said that the translator has to be a stupid one, hell no, it is pretty much
  53. : intelligent in that respect, that is one of the fields in which it excels i think, to be able
  54. : to resolve dynamic addresses. if the branch is to some externally allocated memory, in which
  55. : case you don't have an address, then this falls under the heading of self
  56.  
  57. There are many many cases where You don't know the address. You could get the
  58. adress by an external function or it could be contained in data structure etc.etc.
  59.  
  60. : modifying/relocating code and then you have to simply change the source bytes, meaning the
  61. : code bytes being copied to PPC code ofcourse, however a problem arises if the code size differs
  62. : from the translated code size, then you'll have to locate the code that does the copying and
  63.  
  64. And You have to locate the place where the memory for the code is allocated
  65. and then adjust it according to the new size for the PPC code. And You have to
  66. change all the other points where this size is used e.g in a loop.
  67. There is absolutely no way to do this reliably.
  68.  
  69.  
  70. Volker
  71.  
  72.  
  73.